
from selenium.webdriver.support.ui import WebDriverWait
class Base():
    # 初始化
    def __init__(self,driver):
        self.driver=driver
    def get(self,url):
        self.get(url)
    # 定位
    def find_element(self,loc):
        try:
            WebDriverWait(self.driver,20,0.5).until(lambda driver:self.driver.find_element(*loc).is_displayed())
            return self.driver.find_element(*loc)
        except Exception as f:
            print(f)
    # 点击
    def click(self,loc):
        try:
            self.find_element(loc).click()
        except Exception as f:
            print(f)
    # 输入
    def send_keys(self,loc,info):
        try:
            self.find_element(loc).send_keys(info)
        except Exception as f:
            print(f)
    # 断言
    def text(self,loc):
        try:
            return self.find_element(*loc).text()
        except Exception as f:
            print(f)





